package com.hongxun.project.tool.assets;

import com.hongxun.common.utils.bean.BeanUtils;
import com.hongxun.project.assets.iBoxes.domain.IBoxes;
import com.hongxun.project.assets.iCablePit.domain.ICablePit;
import com.hongxun.project.assets.iDevice.domain.IDevice;
import com.hongxun.project.assets.iMaterial.domain.IMaterial;
import com.hongxun.project.assets.iPicture.domain.IPicture;
import com.hongxun.project.assets.iPoint.domain.IPoint;
import com.hongxun.project.assets.iPole.domain.IPole;
import com.hongxun.project.assets.iPullLine.domain.IPullLine;
import com.hongxun.project.assets.pBoxes.domain.PBoxes;
import com.hongxun.project.assets.pCablePit.domain.PCablePit;
import com.hongxun.project.assets.pDevice.domain.PDevice;
import com.hongxun.project.assets.pMaterial.domain.PMaterial;
import com.hongxun.project.assets.pPicture.domain.PPicture;
import com.hongxun.project.assets.pPoint.domain.PPoint;
import com.hongxun.project.assets.pPole.domain.PPole;
import com.hongxun.project.assets.pPullLine.domain.PPullLine;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by admin on 2019/3/28.
 */
public class I2PUtils {

    public static List<PBoxes> getBoxes(String taskId, List<IBoxes> iBoxes) {
        List<PBoxes> pBoxes = new ArrayList<>();
        for (IBoxes i : iBoxes) {
            PBoxes p = new PBoxes();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PCablePit> getCablePit(String taskId, List<ICablePit> iBoxes) {
        List<PCablePit> pBoxes = new ArrayList<>();
        for (ICablePit i : iBoxes) {
            PCablePit p = new PCablePit();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PDevice> getDevice(String taskId, List<IDevice> iBoxes) {
        List<PDevice> pBoxes = new ArrayList<>();
        for (IDevice i : iBoxes) {
            PDevice p = new PDevice();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PMaterial> getMaterial(String taskId, List<IMaterial> iBoxes) {
        List<PMaterial> pBoxes = new ArrayList<>();
        for (IMaterial i : iBoxes) {
            PMaterial p = new PMaterial();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PPole> getPole(String taskId, List<IPole> iBoxes) {
        List<PPole> pBoxes = new ArrayList<>();
        for (IPole i : iBoxes) {
            PPole p = new PPole();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PPicture> getPicture(String taskId, List<IPicture> iBoxes) {
        List<PPicture> pBoxes = new ArrayList<>();
        for (IPicture i : iBoxes) {
            PPicture p = new PPicture();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PPullLine> getPullLine(String taskId, List<IPullLine> iBoxes) {
        List<PPullLine> pBoxes = new ArrayList<>();
        for (IPullLine i : iBoxes) {
            PPullLine p = new PPullLine();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

    public static List<PPoint> getPoint(String taskId, List<IPoint> iBoxes) {
        List<PPoint> pBoxes = new ArrayList<>();
        for (IPoint i : iBoxes) {
            PPoint p = new PPoint();
            BeanUtils.copyBeanProp(p, i);
            p.setTaskId(taskId);
            p.setDatastate("已同步");
            pBoxes.add(p);
        }
        return pBoxes;
    }

}
